import codecs
import configparser
import os
pro_dir=os.path.split(os.path.realpath(__file__))[0]
print(pro_dir)
configpath =os.path.join(pro_dir,"config.ini")
print(configpath)
class ReadConfig:
    def __init__(self):
        fd=open(configpath)
        data=fd.read()
        if data[:3]==codecs.BOM_UTF8:
            data=data[:3]
            file=codecs.open(configpath,"w")
            file.close()
        fd.close()
        self.cf=configparser.ConfigParser()
        self.cf.read(configpath)
    def get_email(self,name):
        value =self.cf.get("EMAIL",name)
        return value
    def get_http(self,name):
        value = self.cf.get("HTTP",name)
        return value
    def get_db(self,name):
        value = self.cf.get("DATABASE",name)
        return value

